<template>
  <div class="breadcrumb">{{breadcrumb}}</div>
</template>

<script>
export default {
  computed: {
    breadcrumb() {
      // 嵌套路由信息都在this.$route.matched
      // 遍历获取每一个匹配到的组件的 meta 即可生成面包屑
      let res = "";
      this.$route.matched.forEach(element => {
        res += element.meta + "->";
      });
      return res;
    }
  }
};
</script>

<style lang="less" scoped>
.breadcrumb {
  padding: 10px 0;
}
</style>